<template>
    <form class="contact-form-1" method="post" action="#" onsubmit="return false;" autocomplete>
       <div class="row">
        <div class="form-group col-lg-6">
            <input type="text" name="fullname" placeholder="公司" v-model="Company" required />
        </div>
        <div class="form-group col-lg-6">
            <input type="text" name="fullname" placeholder="您的名字" v-model="Name" required />
        </div>
        

       
       </div>
       <div class="row">
        <div class="form-group col-lg-6">
            <input type="number" name="phone" placeholder="您的电话号码" v-model="numbers"
                oninput="if(value.length>11)value=value.slice(0,11)"
                onkeypress='return( /[\d]/.test(String.fromCharCode(event.keyCode)))' required />
        </div>
        <div class="form-group col-lg-6">
            <input type="email" name="email" placeholder="您的电子邮件地址" v-model="Address" required />
        </div>
       </div>
      
       
        <div class="form-group">
            <textarea name="message" placeholder="您的留言" v-model="Message" required>
                </textarea>
        </div>

        <div class="form-group">
            <button class="btn-collors btn-large btn-default" @click="submit()">提交信息</button>
        </div>

        <!-- <div class="form-group" v-html="showResult ? result : null"/> -->
    </form>
</template>

<script>
import { Submit, cscscs } from '@/api/submit'
export default {
    name: 'ContactForm',
    data() {
        return {
            // showResult: false,
            // result: `<p class="success-message">Your Message has been successfully sent. I will contact you soon.</p>`,
            Company:'',
            Name: "",
            Address: "",
            numbers: "",
            Subject: "",
            Message: "",

        }
    },
    methods: {
        // sendEmail() {
        //     this.showResult = true
        // },
        async submit() {
            if (this.Name != '' || this.Address != '' || this.Message != '' || this.numbers != '') {
                Submit({ name: this.Name, mail: this.Address, news: this.Message, tel: this.numbers }).then(res => {
                        this.Name = '',
                        this.Address = '',
                        this.numbers = '',
                        this.Message = ''
                        this.$message.success('提交成功');

                })

            } else {
                this.$message('请输入您的信息');
            }

        }
    }
}
</script>
<style>
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.btn-collors {
    background: #4c6efd !important;
}
</style>